home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / misc / pocketcalc.lha / PocketCalc / Source / PocketCalc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-27  |  2.7 KB  |  80 lines

  1. #ifndef POCKETCALC_H
  2. #define POCKETCALC_H
  3.  
  4. /*
  5. **       $Filename: PocketCalc.h $
  6. **       $Release: 1 $
  7. **       $Revision: 37.1 $
  8. **       $Date: 17/02/95 $
  9. **
  10. **       (C) Copyright 1995 Alex Taylor
  11. **       All Rights Reserved
  12. */
  13.  
  14. /*----------------------------------------------------------------------------*/
  15. /*    Includes & Defines                                                      */
  16. /*----------------------------------------------------------------------------*/
  17.  
  18. #include <math.h>                         /* standard C includes */
  19. #include <stdio.h>
  20. #include <string.h>
  21.  
  22. #include <exec/types.h>                   /* Amiga includes */
  23. #include <libraries/mui.h>
  24. #include <utility/hooks.h>
  25.  
  26. #include <clib/alib_protos.h>             /* C prototypes */
  27. #include <proto/exec.h>                   /* Amiga prototypes */
  28. #include <proto/muimaster.h>
  29.  
  30. #define MaxChars 11                 /* maximum number of characters in buffer */
  31. #define BufferSize 30               /* the buffer is actually somewhat bigger */
  32.                              /* in order to catch any overflow from sprintf() */
  33.  
  34. #define MAKEID(a,b,c,d) ((ULONG)(a)<<24|(ULONG)(b)<<16|(ULONG)(c)<<8|(ULONG)(d))
  35. #define ASM __saveds __asm
  36. #define REG(x) register __ ## x
  37.  
  38. #define EQUALS 0L
  39. #define PLUS 1L                   /* constants for use in 'switch' statements */
  40. #define MINUS 2L                  /* and so on */
  41. #define MULTIPLY 3L
  42. #define DIVIDE 4L
  43. #define SQRT 5L
  44. #define SQUARE 6L
  45. #define NEGATE 7L
  46. #define ID_PI 8L
  47. #define ID_RECALL 9L
  48. #define ID_MEMPLUS 10L
  49. #define ID_MEMMINUS 11L
  50. #define ID_CLEAR 12L
  51. #define ID_ALLCLEAR 13L
  52.  
  53. /*----------------------------------------------------------------------------*/
  54. /*    Protos                                                                  */
  55. /*----------------------------------------------------------------------------*/
  56.  
  57. void main(void);
  58. static BOOL MakeMUIApp(void);
  59. static APTR MakeButton(UBYTE *, UBYTE);
  60. static ASM void ProcessDigit(REG(a2) APTR, REG(a1) UBYTE *);
  61. static ASM void DoOperation(REG(a2) APTR, REG(a1) ULONG *);
  62. static void ClearBuffer(void);
  63. static void DoError(void);
  64. static void UpdateDisplay(long double);
  65.  
  66. /*----------------------------------------------------------------------------*/
  67. /*    Misc - global variables                                                 */
  68. /*----------------------------------------------------------------------------*/
  69.  
  70. APTR App, Win, Display;
  71. UBYTE DigitBuffer[BufferSize];
  72. ULONG Cursor = 0L, NextOperation = 0L;
  73. BOOL Decimal = FALSE, Error = FALSE;
  74. long double Operand1, Operand2, CurrentOperand, Memory;
  75.    /* long doubles for accuracy - 96-bit floats! */
  76.  
  77. struct Library *MUIMasterBase;      /* pointer to the base of the library */
  78.  
  79. #endif /* POCKETCALC_H */
  80.